#ifndef _THREAD_EXTENSIONS_H
#define _THREAD_EXTENSIONS_H

#include <pthread.h>
#include <signal.h>
#include <semaphore.h>
#include <unistd.h>

/*
 ================================================================
 Assorted Useful Functions
 ================================================================
 */

extern char *thread_name(pthread_t);

int PTHREAD_CREATE(pthread_t *new_thread_ID, const pthread_attr_t *attr,
      void * (*start_func)(void *), void *arg);

int PTHREAD_ATTR_INIT(pthread_attr_t *a);

int PTHREAD_CONDATTR_INIT(pthread_condattr_t *a);

int PTHREAD_MUTEXATTR_INIT(pthread_mutexattr_t *a);

int SEM_INIT(sem_t *sem, int pshared, unsigned int value);

int SEM_WAIT(sem_t *arg);

void thread_single_barrier(sem_t *barrier, int count);

#endif /* _THREAD_EXTENSIONS_H */
